Skip to content

test(agents): avoid repeating every stream delta - #4171

Merged
dpiet-oai merged 2 commits into
mainfrom
dp/project-fast-ci-02-python-stream-cache
Oct 26, 2026
Merged

dpiet-oai merged 2 commits into
mainfrom
dp/project-fast-ci-02-python-stream-cache

Conversation

@dpiet-oai

@dpiet-oai dpiet-oai commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

The long agent-session stream test delivered every one of 5,000 distinct deltas twice. Keep all 5,000 distinct deltas and 3,978 cache evictions before tool replay, while repeating only the last delta to verify duplicate suppression after sustained eviction. Both client modes assert that the evicted tool event is delivered twice and its handler runs once.

Validation: tests/lib/streaming/agents/test_streams.py (90 passed, 4 skipped); Ruff lint and format checks passed. Three serial local trials per revision on Python 3.10.16 / Pydantic 1.10.26 (DEFER_PYDANTIC_BUILD=false, pytest -n 0): median test-call times 2.64s → 1.42s sync and 2.35s → 1.20s async. Whole-gate savings have not been established.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Castiron custom code

Evaluated main: a93b62c2638d41031a661d3ed9c2155860ccb9b3.

Trusted main policy: a93b62c2638d41031a661d3ed9c2155860ccb9b3.

✅ No new custom-code files detected.

0 mixed files remain; 0 existing customizations changed.

Compared 43045fcaf91a → eac0a17f9265. Generated baselines verified.

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 40372530606 --repo openai/openai-python \
  --name castiron-custom-code-40372530606-1 --dir /tmp/castiron-custom-code-40372530606-1
git apply --stat /tmp/castiron-custom-code-40372530606-1/custom-code.patch
cat /tmp/castiron-custom-code-40372530606-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin a93b62c2638d41031a661d3ed9c2155860ccb9b3 eac0a17f926531004a04872b2a215dce549ce76b
python3 scripts/castiron/custom_code_report.py report \
  --base a93b62c2638d41031a661d3ed9c2155860ccb9b3 \
  --head eac0a17f926531004a04872b2a215dce549ce76b --target-branch main --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-eac0a17f9265
cat /tmp/castiron-custom-code-eac0a17f9265/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@marcuswood-oai marcuswood-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 No changes requested.

The focused cache-state probe passed. The draft CI run skipped test and lint jobs; I did not independently rerun the SDK tests.


Reviewed: fc44b250a21b · Base: 43045fcaf91a · sdk-pr-review

@markstuart-oai markstuart-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed fc44b250a21b3c18fd86c7490c5d2872ab60f9d5. No blocking findings. The reduced event count still exceeds the actual cache capacity. Both client modes now explicitly verify tool-event eviction and replay while retaining duplicate suppression, one tool invocation, cache bounds, and stream cleanup.

Source-only review; I did not run candidate code or tests. Hosted checks: 13 skipped, 22 success.

@dpiet-oai
dpiet-oai marked this pull request as ready for review October 26, 2026 17:45
@dpiet-oai
dpiet-oai requested a review from a team as a code owner October 26, 2026 17:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T17:47:08.689896Z fc44b25 Draft marked ready
🔒 Security Review ✅ Completed 2026-10-26T17:47:27.859802Z fc44b25 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc44b250a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/lib/streaming/agents/test_streams.py Outdated
@dpiet-oai dpiet-oai changed the title test(agents): shorten stream cache eviction test test(agents): avoid repeating every stream delta Oct 26, 2026

@marcuswood-oai marcuswood-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 No changes requested.

The revised fixture preserves sustained eviction and checks duplicate suppression after the cache fills, while verifying tool-event replay without a second handler invocation in both client modes.


Reviewed: eac0a17f9265 · Base: 43045fcaf91a · sdk-pr-review

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed eac0a17. No changes requested. The fixture retains all 5,000 distinct deltas and 3,978 evictions before tool replay. Repeating the final delta still exercises duplicate suppression after sustained eviction; exact delta-list equality catches duplicate delivery. The new two-delivery assertion proves the original tool event was evicted and replayed, while single handler invocation and two inputs retain tool-call deduplication coverage in both client modes. Cache bounds and cleanup checks remain. This addresses the earlier reduced-fixture finding.

Static review of the diff, surrounding stream implementation, existing coverage and feedback, plus independent review. No candidate code or tests run locally. Current-head hosted checks: 24 successful, 15 skipped, none pending or failing (including successful OkTest).

@dpiet-oai
dpiet-oai added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 9f8d65b Oct 26, 2026
42 checks passed
@dpiet-oai
dpiet-oai deleted the dp/project-fast-ci-02-python-stream-cache branch October 26, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants